#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;

int row(int y, vector<vector<int>> &coor)
{
  int result = 0;
  for(int i = 0; i < coor.size(); ++i)
  {
    if(coor[i][1] == y)
    {
      ++result;
    }
  }
  return result;
}

int col(int x, vector<vector<int>> &coor)
{
  int result = 0;
  for(int i = 0; i < coor.size(); ++i)
  {
    if(coor[i][0] == x)
    {
      ++result;
    }
  }
  return result;
}

int bl_trD(int sum, vector<vector<int>> &coor)
{
  int result = 0;
  for(int i = 0; i < coor.size(); ++i)
  {
    if(coor[i][0] + coor[i][1] == sum)
    {
      ++result;
    }
  }
  return result;
}

int tl_brD(int diff, vector<vector<int>> &coor)
{
  int result = 0;
  for(int i = 0; i < coor.size(); ++i)
  {
    if(coor[i][0] - coor[i][1] == diff)
    {
      ++result;
    }
  }
  return result;
}

int main(int argc, char const *argv[])
{
  vector<vector<int>> positions {{2, 1}, {3, 2}, {5, 2}, {4, 3}, {3, 4}, {6, 5}};
  cout << row(3, positions) << endl << col(3, positions) << endl << bl_trD(3, positions) << endl << tl_brD(3, positions) << endl;
  return 0;
}
